home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-19 | 78.9 KB | 2,342 lines | [TEXT/MPS ] |
- Received-Date: Sun, 15 May 1994 21:57:15 +0200
- From: pottier@clipper.ens.fr (Francois Pottier)
- Subject: csmp-digest-v3-027
- To: csmp-digest@ens.fr
- Date: Sun, 15 May 94 21:57:08 MET DST
- X-Mailer: ELM [version 2.3 PL11]
- Errors-To: listman@ens.fr
- Reply-To: pottier@clipper.ens.fr
- X-Sequence: 30
-
- C.S.M.P. Digest Sun, 15 May 94 Volume 3 : Issue 27
-
- Today's Topics:
-
- Determining if user has a CD ROM drive
- Lex and Yacc for Mac Programmers
- PowerMac FP performance - interesting results????
- Saving the floating Point Registers
- The NewWindow case
- Truetype font format specification: No longer available from Apple ?!
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
- (pottier@clipper.ens.fr).
-
- The digest is a collection of article threads from the internet newsgroup
- comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
- regularly and want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. If you don't have access to news, you may
- still be able to post messages to the group by using a mail server like
- anon.penet.fi (mail help@anon.penet.fi for more information).
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- nef.ens.fr). Article threads are not added to the digest until the last
- article added to the thread is at least two weeks old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The digest is officially distributed by two means, by email and ftp.
-
- If you want to receive the digest by mail, send email to listserv@ens.fr
- with no subject and one of the following commands as body:
- help Sends you a summary of commands
- subscribe csmp-digest Your Name Adds you to the mailing list
- signoff csmp-digest Removes you from the list
- Once you have subscribed, you will automatically receive each new
- issue as it is created.
-
- The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
- Questions related to the ftp site should be directed to
- scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
- digest are available there.
-
- Also, the digests are available to WAIS users as comp.sys.mac.programmer.src.
-
-
- -------------------------------------------------------
-
- >From mkelly@cs.uoregon.edu (Michael A. Kelly)
- Subject: Determining if user has a CD ROM drive
- Date: 25 Apr 1994 15:18:08 -0700
- Organization: High Risk Ventures
-
-
- Hey,
-
- Is there any way to determine (through software) if a given machine has a
- CD ROM drive attached to it? Do I just have to look for an unwritable disk
- larger than 500MB (and wouldn't that only show up if there's a CD mounted)?
- Is there any other way?
-
- Thanks,
-
- Mike.
- --
- _____________________________________________________________________________
- Michael A. Kelly President/CEO
- mkelly@cs.uoregon.edu High Risk Ventures
- _____________________________________________________________________________
-
- +++++++++++++++++++++++++++
-
- >From mxmora@unix.sri.com (Matt Mora)
- Date: 25 Apr 1994 16:55:17 -0700
- Organization: SRI International, Menlo Park, CA
-
- In article <2phfj0$95h@majestix.cs.uoregon.edu> mkelly@cs.uoregon.edu (Michael A. Kelly) writes:
- >
- >Hey,
- >
- >Is there any way to determine (through software) if a given machine has a
- >CD ROM drive attached to it? Do I just have to look for an unwritable disk
- >larger than 500MB (and wouldn't that only show up if there's a CD mounted)?
- >Is there any other way?
-
-
- Sure,
-
- Here you go:
-
- //------------------------------------------------------------
- pascal OSErr OpenCD(Byte CDDrive, short *ioRefNum) {
- //------------------------------------------------------------
-
- auto OSErr osErr;
- auto short ioRefNumTemp,
- CDDriveCount,
- SCSIID;
- auto WhoIsThereRec *pb;
-
- pb = (WhoIsThereRec *) NewPtrClear(sizeof (*pb));
- osErr = MemError();
- if (0 != pb && noErr == osErr) {
- osErr = OpenDriver("\p.AppleCD", &ioRefNumTemp);
- if (noErr == osErr) {
- (*pb).ioRefNum = ioRefNumTemp;
- (*pb).csCode = csWhoIsThere;
- osErr = PBStatus((ParmBlkPtr)pb, false);
- if (noErr == osErr) {
- CDDriveCount = 0;
- for (SCSIID = 0; SCSIID < 7; ++SCSIID) {
- if (BitTst(&(*pb).csParam.SCSIMask, 7 - SCSIID)) {
- ++CDDriveCount;
- if (CDDrive == CDDriveCount) {
- *ioRefNum = -(32 + SCSIID) - 1;
- DisposPtr((Ptr) pb);
- return noErr;
- }
- }
- }
- osErr = paramErr;
- }
- }
- DisposPtr((Ptr) pb);
- }
- return osErr;
- }
-
-
- I didn't write it it came from:
-
- // imWare
- // Wednesday, February 14, 1990
- // James Beninghaus
-
-
- Xavier
-
-
- --
- ___________________________________________________________
- Matthew Xavier Mora Matt_Mora@sri.com
- SRI International mxmora@unix.sri.com
- 333 Ravenswood Ave Menlo Park, CA. 94025
-
- +++++++++++++++++++++++++++
-
- >From mclow@csusm.edu (Marshall Clow)
- Date: 26 Apr 1994 00:36:17 GMT
- Organization: (none)
-
- Matt Mora (mxmora@unix.sri.com) wrote:
- >In article <2phfj0$95h@majestix.cs.uoregon.edu> mkelly@cs.uoregon.edu
- > (Michael A. Kelly) writes:
- >>
- >>Hey,
- >>
- >>Is there any way to determine (through software) if a given machine has a
- >>CD ROM drive attached to it? Do I just have to look for an unwritable disk
- >>larger than 500MB (and wouldn't that only show up if there's a CD mounted)?
- >>Is there any other way?
-
-
- >Sure,
-
- >Here you go:
-
- [ code deleted ]
-
- Matt,
- Pardon me if I missed something, but the code that you posted
- only works if the Apple CD-ROM drivers are installed. What if the CD-ROM
- that the user has uses it's own, custom driver?
-
- Perhaps if the original poster could provide some more information
- about what he was trying to accomplish, someone could suggest a solution.
-
- -- Marshall
-
- Marshall Clow
- I are an Engineer!
- Aladdin Systems
- mclow@san_marcos.csusm.edu
-
-
- +++++++++++++++++++++++++++
-
- >From mkelly@cs.uoregon.edu (Michael A. Kelly)
- Date: 26 Apr 1994 00:08:21 -0700
- Organization: High Risk Ventures
-
- In article <2phnm1$dqm@coyote.csusm.edu>,
- Marshall Clow <mclow@csusm.edu> wrote:
- > Pardon me if I missed something, but the code that you posted
- >only works if the Apple CD-ROM drivers are installed. What if the CD-ROM
- >that the user has uses it's own, custom driver?
- >
- >Perhaps if the original poster could provide some more information
- >about what he was trying to accomplish, someone could suggest a solution.
-
- I simply want to know if there is a CD ROM drive attached to the machine.
- I am not going to do anything with that information, besides take note of
- it. It will become part of a 'system code' that the user can give to a
- tech support person when there is trouble - rather than the tech support
- person having to ask the user for each tidbit of information, they just
- ask for this code, which immediately gives them all the basic information
- they need about the user's machine.
-
- Of course, whether or not the user has a CD ROM drive is pretty unimportant
- for tech support (if it was important it would probably be given). This
- system code is also used to give us some statistics about the number of
- CD ROM drives in our customer base.
-
- All of this is irrelevant to the question at hand, though.
-
- Mike.
- --
- _____________________________________________________________________________
- Michael A. Kelly President/CEO
- mkelly@cs.uoregon.edu High Risk Ventures
- _____________________________________________________________________________
-
- +++++++++++++++++++++++++++
-
- >From d88-jwa@dront.nada.kth.se (Jon Wdtte)
- Date: 26 Apr 1994 08:10:11 GMT
- Organization: The Royal Institute of Technology
-
- In <2phfj0$95h@majestix.cs.uoregon.edu> mkelly@cs.uoregon.edu (Michael A. Kelly) writes:
-
- >Is there any way to determine (through software) if a given machine has a
- >CD ROM drive attached to it? Do I just have to look for an unwritable disk
-
- Use the SCSI manager to examine all SCSI devices and look for a CD-ROM
- type device.
-
- But why? Most users can be trusted to look around their computer, see
- "hey, here's a CD-ROM" and check the appropriate check box; that's
- several magnitudes safer than any automatic check.
-
- And if you're gathering statistics behind the users back, don't.
- Remember that Prograph was close to being publicly flogged for the
- "Exploding Pink Poodles" stuff, which was something their mastering
- company put there.
- --
- -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
- "Don't Deal with a Dragon."
-
- +++++++++++++++++++++++++++
-
- >From d88-jwa@dront.nada.kth.se (Jon Wdtte)
- Date: 26 Apr 1994 08:11:07 GMT
- Organization: The Royal Institute of Technology
-
- In <2phl95$i30@unix.sri.com> mxmora@unix.sri.com (Matt Mora) writes:
-
- > osErr = OpenDriver("\p.AppleCD", &ioRefNumTemp);
-
- There are other CD-ROM drivers than Apple's CD driver, like
- NECs or Toshibas. This solution loses.
- --
- -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
- "Don't Deal with a Dragon."
-
- +++++++++++++++++++++++++++
-
- >From mxmora@unix.sri.com (Matt Mora)
- Date: 26 Apr 1994 10:47:41 -0700
- Organization: SRI International, Menlo Park, CA
-
- In article <2phnm1$dqm@coyote.csusm.edu> mclow@csusm.edu (Marshall Clow) writes:
-
- >Matt,
- > Pardon me if I missed something, but the code that you posted
- >only works if the Apple CD-ROM drivers are installed. What if the CD-ROM
- >that the user has uses it's own, custom driver?
-
-
- Picky, Picky. Test for non-apple drivers is left as an exercise for the
- reader. :-)
-
- I thought that he might want to do something usefull like distribute
- his games on CDrom chock full of 32 bit sounds and graphics using driver
- calls for access.
-
-
-
- Xavier
-
-
-
- --
- ___________________________________________________________
- Matthew Xavier Mora Matt_Mora@sri.com
- SRI International mxmora@unix.sri.com
- 333 Ravenswood Ave Menlo Park, CA. 94025
-
- +++++++++++++++++++++++++++
-
- >From mkelly@cs.uoregon.edu (Michael A. Kelly)
- Date: 26 Apr 1994 11:46:35 -0700
- Organization: High Risk Ventures
-
- In article <2pii93$hls@news.kth.se>,
- Jon Wdtte <d88-jwa@dront.nada.kth.se> wrote:
- >Use the SCSI manager to examine all SCSI devices and look for a CD-ROM
- >type device.
-
- How do I do that? I've been looking at the SCSI Manager in Think Reference,
- and I can't figure out how to tell if the device is a CD ROM device.
-
- >Remember that Prograph was close to being publicly flogged for the
- >"Exploding Pink Poodles" stuff, which was something their mastering
- >company put there.
-
- I don't remember anything about that - what happened?
-
- We have no intention of making the data we gather public in any way - it's
- strictly for our own information. So that someday in the future when we're
- thinking that we'd like to make an action CD game, we can look at our
- customer base and see what percentage of action game players have a CD drive.
- I don't expect the information to be all that useful, or reliable, but it
- doesn't hurt to gather it.
-
- Mike.
- --
- _____________________________________________________________________________
- Michael A. Kelly President/CEO
- mkelly@cs.uoregon.edu High Risk Ventures
- _____________________________________________________________________________
-
- +++++++++++++++++++++++++++
-
- >From isis@netcom.com (Mike Cohen)
- Date: Tue, 26 Apr 1994 17:40:03 GMT
- Organization: ISIS International
-
- mxmora@unix.sri.com (Matt Mora) writes:
-
- >In article <2phfj0$95h@majestix.cs.uoregon.edu> mkelly@cs.uoregon.edu (Michael A. Kelly) writes:
- >>
- >>Hey,
- >>
- >>Is there any way to determine (through software) if a given machine has a
- >>CD ROM drive attached to it? Do I just have to look for an unwritable disk
- >>larger than 500MB (and wouldn't that only show up if there's a CD mounted)?
- >>Is there any other way?
-
-
- >Sure,
-
- >Here you go:
- (code snippet deleted)
- >I didn't write it it came from:
-
- >// imWare
- >// Wednesday, February 14, 1990
- >// James Beninghaus
-
- This is the cleanest way (I've done it that way myself for an ISO9660 CD
- browser), but it will only work for an Apple or compatible drive.
- --
- Mike Cohen - isis@netcom.com
- NewtonMail, eWorld: MikeC / ALink: D6734 / AOL: MikeC20
-
- +++++++++++++++++++++++++++
-
- >From Phil Smy <psmy@io.org>
- Date: 27 Apr 1994 13:50:26 GMT
- Organization: Innotech MultiMedia Corp.
-
- In article <2piiar$hlt@news.kth.se> Jon W!tte, d88-jwa@dront.nada.kth.se
- writes:
- >> osErr = OpenDriver("\p.AppleCD", &ioRefNumTemp);
- >
- >There are other CD-ROM drivers than Apple's CD driver, like
- >NECs or Toshibas. This solution loses.
-
- Actually, for some reason, with NEC drivers this does work! They must
- register themselves (actually I think all cd drivers do) as ".AppleCD".
-
- Phil
- ******************************************************************
- * Phil Smy * Interactive CDRom MultiMedia *
- * Sr. Developer * #include <stddisclaimer.h> *
- * Innotech MultiMedia Corp. * Wot Gorilla? *
- ******************************************************************
-
- +++++++++++++++++++++++++++
-
- >From sch@unx.sas.com (Steve Holzworth)
- Date: Wed, 27 Apr 1994 21:10:12 GMT
- Organization: SAS Institute Inc.
-
- mkelly@cs.uoregon.edu (Michael A. Kelly) writes:
-
- >In article <2pii93$hls@news.kth.se>,
- >Jon Wdtte <d88-jwa@dront.nada.kth.se> wrote:
- >>Use the SCSI manager to examine all SCSI devices and look for a CD-ROM
- >>type device.
-
- >How do I do that? I've been looking at the SCSI Manager in Think Reference,
- >and I can't figure out how to tell if the device is a CD ROM device.
-
- The SCSI "Inquiry" command returns info about the specified SCSI device,
- including a code which says that it is a ROM, WORM, DISK, etc.
-
- A peripheral type 5 should be a CD-ROM drive.
- --
- Steve Holzworth
- sch@unx.sas.com "Do not attribute to poor spelling
- SAS Institute x6872 That which is actually poor typing..."
- SAS/Macintosh Development Team - me
- Cary, N.C.
-
- +++++++++++++++++++++++++++
-
- >From mkelly@cs.uoregon.edu (Michael A. Kelly)
- Date: 28 Apr 94 08:30:22 GMT
- Organization: High Risk Ventures
-
- In article <sch.767481012@gargoyle>, Steve Holzworth <sch@unx.sas.com> wrote:
- >
- >The SCSI "Inquiry" command returns info about the specified SCSI device,
- >including a code which says that it is a ROM, WORM, DISK, etc.
-
- OK, but the problem is that I don't have the scsi specs, so I don't know
- how to send an inquiry command or get the id from whatever it returns....
-
- Mike.
- --
- _____________________________________________________________________________
- Michael A. Kelly President/CEO
- mkelly@cs.uoregon.edu High Risk Ventures
- _____________________________________________________________________________
-
- +++++++++++++++++++++++++++
-
- >From sch@unx.sas.com (Steve Holzworth)
- Date: Thu, 28 Apr 1994 22:37:52 GMT
- Organization: SAS Institute Inc.
-
- mkelly@cs.uoregon.edu (Michael A. Kelly) writes:
-
- >In article <sch.767481012@gargoyle>, Steve Holzworth <sch@unx.sas.com> wrote:
- >>
- >>The SCSI "Inquiry" command returns info about the specified SCSI device,
- >>including a code which says that it is a ROM, WORM, DISK, etc.
-
- >OK, but the problem is that I don't have the scsi specs, so I don't know
- >how to send an inquiry command or get the id from whatever it returns....
-
- I hope you have Macintosh documentation on the SCSI Manager, otherwise
- the problem becomes too complex, short of me writing you the actual code
- to do the Inquiry. Assuming you DO have the SCSI Manager doc, use a
- SCSI command block as follows:
-
- The SCSI Inquiry command is command code 0x12.
- The command block is as follows (conforms to SCSI2 spec):
-
- Bits
- | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
- Byte
- 0 Inquiry (0x12)
- 1 | LogUnit# | 0 |
- 2 0
- 3 0
- 4 Allocation Length
- 5 0
-
- LogUnit# is a logical unit at this SCSI ID, and should almost always be
- zero (note, this isn't the same as the SCSI ID itself; it's a sub-unit).
-
- Allocation Length is the size of the maximum buffer that should be returned
- by this command. You only care about the first byte, so try 1. The Macintosh
- is good about throwing away excess bytes and resyncing the SCSI handshake.
-
- The first byte returned is the device type, as mentioned in the previous
- post.
-
- --
- Steve Holzworth
- sch@unx.sas.com "Do not attribute to poor spelling
- SAS Institute x6872 That which is actually poor typing..."
- SAS/Macintosh Development Team - me
- Cary, N.C.
-
- +++++++++++++++++++++++++++
-
- >From tzs@u.washington.edu (Tim Smith)
- Date: 1 May 1994 06:32:31 GMT
- Organization: University of Washington School of Law, Class of '95
-
- Michael A. Kelly <mkelly@cs.uoregon.edu> wrote:
- >How do I do that? I've been looking at the SCSI Manager in Think Reference,
- >and I can't figure out how to tell if the device is a CD ROM device.
-
- Try this. The following was written when Think C first came out with
- the objected oriented extensions, and was my first attempt to use
- them, which is why it goes a bit overboard. The first two files
- below define an object oriented interface to the SCSI manager.
- The third file scans the SCSI bus looking for a tape drive.
- At the end, I'll tell you where to change it to look for a
- CD-ROM drive.
-
- - -------- file cscsi.h ----------
-
- #ifndef CSCSI_H
- #define CSCSI_H
-
- #include <SCSI.H>
-
- typedef enum
- {
- dataIn=1, dataOut=2, noData=3
- } XferDir;
-
- #define USE_CDB 0x01
- #define USE_BUF 0x02
- #define USE_LEN 0x04
- #define USE_DIR 0x08
- #define USE_ID 0x10
-
- #define CAN_DATA (USE_CDB|USE_BUF|USE_LEN|USE_DIR|USE_ID)
- #define CAN_NO_DATA (USE_CDB|USE_DIR|USE_ID)
-
- #define SCSI_NEED_INFO (-1)
- #define SCSI_OK (0)
-
- class CSCSIOp
- {
- short targetID;
- char cdb[12];
- char cdbLen;
- unsigned char * dataPtr;
- long dataLen;
- short status;
- short message;
- OSErr err;
- XferDir dir;
- long timeout;
- int haveInfo;
- long moved;
- public:
- CSCSIOp( void );
- ~CSCSIOp( void );
- void keep( int what );
- void setID( short ID );
- void setCDB( int len, char * cdbPtr );
- void set6( char a, char b, char c, char d, char e, char f );
- void set10( char a, char b, char c, char d, char e, char f,
- char g, char h, char i, char j );
- void set12( char a, char b, char c, char d, char e, char f,
- char g, char h, char i, char j, char k, char l );
- void setLen( long len );
- void setBuf( void * buf );
- void setDir( XferDir direction );
- int execute( void );
- short getStatus( void );
- short getMessage( void );
- void setTimeout( long newTime );
- OSErr getErr( void );
- long getMoved( void );
- };
-
- #endif
-
- - ------ file cscsi.cp ------------
-
- #include "CSCSI.h"
- #include <stdio.h>
-
- CSCSIOp::CSCSIOp( void )
- {
- haveInfo = 0;
- timeout = 60L;
- }
-
- CSCSIOp::~CSCSIOp( void )
- {
- }
-
- void CSCSIOp::keep( int what )
- {
- haveInfo = what;
- }
-
- void CSCSIOp::setID( short ID )
- {
- targetID = ID;
- haveInfo |= USE_ID;
- }
-
- void CSCSIOp::setCDB( int len, char * cdbPtr )
- {
- int i;
- cdbLen = len;
- for ( i = 0; i < len; i++ )
- cdb[i] = *cdbPtr++;
- haveInfo |= USE_CDB;
- }
-
- void CSCSIOp::set6( char a, char b, char c, char d, char e, char f )
- {
- cdbLen = 6;
- cdb[0] = a; cdb[1] = b; cdb[2] = c; cdb[3] = d; cdb[4] = e; cdb[5] = f;
- haveInfo |= USE_CDB;
- }
-
- void CSCSIOp::set10( char a, char b, char c, char d, char e, char f,
- char g, char h, char i, char j )
- {
- cdbLen = 10;
- cdb[0] = a; cdb[1] = b; cdb[2] = c; cdb[3] = d; cdb[4] = e; cdb[5] = f;
- cdb[6] = g; cdb[7] = h; cdb[8] = i; cdb[9] = j;
- haveInfo |= USE_CDB;
- }
-
- void CSCSIOp::set12( char a, char b, char c, char d, char e, char f,
- char g, char h, char i, char j, char k, char l )
- {
- cdbLen = 12;
- cdb[0] = a; cdb[1] = b; cdb[2] = c; cdb[3] = d; cdb[4] = e; cdb[5] = f;
- cdb[6] = g; cdb[7] = h; cdb[8] = i; cdb[9] = j; cdb[10] = k; cdb[11] = l;
- haveInfo |= USE_CDB;
- }
-
- void CSCSIOp::setLen( long len )
- {
- dataLen = len;
- haveInfo |= USE_LEN;
- }
-
- void CSCSIOp::setBuf( void * buf )
- {
- dataPtr = (unsigned char *)buf;
- haveInfo |= USE_BUF;
- }
-
- void CSCSIOp::setDir( XferDir direction )
- {
- dir = direction;
- haveInfo |= USE_DIR;
- }
-
- int CSCSIOp::execute( void )
- {
- SCSIInstr xfer[3];
- int info = haveInfo;
-
- haveInfo = 0;
-
- if ( info & USE_DIR )
- {
- if ( dir == noData )
- {
- if ( (info & CAN_NO_DATA) != CAN_NO_DATA )
- {
- return err = SCSI_NEED_INFO;
- }
- }
- else if ( (info & CAN_DATA) != CAN_DATA )
- {
- return err = SCSI_NEED_INFO;
- }
- }
- else
- return err = SCSI_NEED_INFO;
-
- if ( dir != noData )
- {
- //
- // SCSIManager seems to update scParam1 on scInc only if the scInc did
- // not fail. Thus, if we need to know the exact data count, we need
- // to use a loop, doing on scInc for each byte.
- //
- // If the dataLen is not a multiple of 0x200, we assume the user needs
- // to know the exact amount, and so we loop. If the dataLen is a multiple
- // of 0x200, we assume it is a read or write to a blocked device, and the
- // user wants efficiency more than an exact byte count.
- //
- if ( dataLen & 0x1ff )
- {
- xfer[0].scOpcode = scInc;
- xfer[0].scParam1 = (unsigned long)dataPtr;
- xfer[0].scParam2 = 1;
- xfer[1].scOpcode = scLoop;
- xfer[1].scParam1 = -10;
- xfer[1].scParam2 = dataLen;
- xfer[2].scOpcode = scStop;
- }
- else
- {
- xfer[0].scOpcode = scInc;
- xfer[0].scParam1 = (unsigned long)dataPtr;
- xfer[0].scParam2 = dataLen;
- xfer[1].scOpcode = scStop;
- }
- }
-
- moved = 0;
-
- err = SCSIGet();
- if ( err )
- return err;
-
- err = SCSISelect( targetID );
- if ( err )
- return err;
-
- err = SCSICmd( (Ptr)cdb, cdbLen );
- if ( err )
- {
- SCSIComplete( &status, &message, 60L );
- return err;
- }
-
- if ( dir == dataIn )
- err = SCSIRead( (Ptr)xfer );
- else if ( dir == dataOut )
- err = SCSIWrite( (Ptr)xfer );
-
- moved = xfer[0].scParam1 - (unsigned long)dataPtr;
-
- if ( err && err != scPhaseErr )
- {
- SCSIComplete( &status, &message, 60L );
- return err;
- }
-
- err = SCSIComplete( &status, &message, timeout );
-
- return err;
- }
-
- short CSCSIOp::getStatus( void )
- {
- return status;
- }
-
- short CSCSIOp::getMessage( void )
- {
- return message;
- }
-
- void CSCSIOp::setTimeout( long newTime )
- {
- timeout = newTime;
- }
-
- OSErr CSCSIOp::getErr( void )
- {
- return err;
- }
-
- long CSCSIOp::getMoved( void )
- {
- return moved;
- }
-
- - ----- excerpt from main.cp ------
-
- uchar buf[256];
-
- void main( void )
- {
- long i;
- int id;
- CSCSIOp * inq = new CSCSIOp;
- CSCSIOp * cmd = new CSCSIOp;
- CSCSIOp * rew = new CSCSIOp;
- CSCSIOp * load = new CSCSIOp;
- CSCSIOp * sense = new CSCSIOp;
-
- cout << "Tape drive simple test v0.00" << endl;
-
- inq->set6( 18, 0, 0, 0, 255, 0 );
- inq->setBuf( buf );
- inq->setLen( 255 );
- inq->setDir( dataIn );
-
- //
- // Find the tape drive
- //
- for ( id = 0; id < 7; id++ )
- {
- //
- //First, we issue an INQUIRY to see what kind of device it is.
- //
- inq->keep( USE_CDB | USE_DIR | USE_BUF | USE_LEN );
- inq->setID( id );
- inq->execute();
- if ( inq->getErr() )
- continue;
- //
- // Byte 0 of INQUIRY data contains the device type.
- //
- if ( (buf[0] & 0x1f) == 1 )
- {
- //
- // It's a tape drive
- //
-
- - ------------
-
- See that "== 1" in that last if statement? That's where it's checking
- for a tape drive. Change that to 5 for CD-ROM. If you really want
- to be complete, here are the possible devices:
-
- 0 Direct-access device (disk)
- 1 Sequential-access device (tape)
- 2 Printer
- 3 Processor
- 4 Write-once device (some optical disks)
- 5 CD-ROM
- 6 Scanner
- 7 Optical memory (some optical disks)
- 8 Medium changer
- 9 Communications
- 10-11 Graphic Arts Pre-Press devices
-
- --Tim Smith
-
- ---------------------------
-
- >From krame893@cs.uidaho.edu (Brian Kramer)
- Subject: Lex and Yacc for Mac Programmers
- Date: 28 Apr 1994 16:54:36 GMT
- Organization: University of Idaho, Moscow, Idaho
-
- As the title implies, I am looking for lex and yacc (or their equivalents)
- for using for a Mac-based parser of mine.
-
- If anyone can give an ftp address, or least let me know that they exist,
- I would be _extremely_ appreciative!
-
- Brian
-
-
-
- = =
- Brian Kramer
- krame893@cs.uidaho.edu
- Laboratory for Applied Logic
- University of Idaho
- Moscow, ID
- = =
-
- +++++++++++++++++++++++++++
-
- >From neeri@iis.ee.ethz.ch (Matthias Neeracher)
- Date: 29 Apr 94 18:07:22
- Organization: Integrated Systems Laboratory, ETH, Zurich
-
- In article <2popoc$3hu@owl.csrv.uidaho.edu>, krame893@cs.uidaho.edu (Brian Kramer) writes:
-
- > As the title implies, I am looking for lex and yacc (or their equivalents)
- > for using for a Mac-based parser of mine.
-
- Try:
-
- ftp://ftp.switch.ch/software/mac/src/mpw_c/bison-1.22.sit.bin
- ftp://ftp.switch.ch/software/mac/src/think_c/Bison-1.18.cpt.bin
-
- ftp://ftp.switch.ch/software/mac/src/mpw_c/MPW_Perl_bYacc_181.sit.bin
- ftp://ftp.switch.ch/software/mac/src/think_c/BYacc-1.8.2.cpt
-
- ftp://ftp.switch.ch/software/mac/src/mpw_c/flex-2.3.8.sit.bin
- ftp://ftp.switch.ch/software/mac/src/think_c/Flex-2.3.7.cpt.bin
-
- BYacc and Bison are Yacc equivalents. Bison has more faetures, BYacc generates
- code without legal restrictions on it. Flex is a lex equivalent.
-
- Matthias
-
- - ---
- Matthias Neeracher neeri@iis.ethz.ch
- "Have you heard of the new Cambridge compilers ? They distribute
- gear-wear much more evenly"
- -- William Gibson/Bruce Sterling, _The Difference Engine_
-
-
- +++++++++++++++++++++++++++
-
- >From krame893@cs.uidaho.edu (Brian Kramer)
- Date: 29 Apr 1994 21:59:55 GMT
- Organization: University of Idaho, Moscow, Idaho
-
- I have received responses from several people. I was able to locate
- Bison and Yacc (on sumex, umich, among several other places). Thank
- you to those who helped me out.
-
- Brian
-
-
- : = =
- : Brian Kramer
- : krame893@cs.uidaho.edu
- : Laboratory for Applied Logic
- : University of Idaho
- : Moscow, ID
- : = =
-
- ---------------------------
-
- >From bcorrie@csr.UVic.CA (Brian Corrie)
- Subject: PowerMac FP performance - interesting results????
- Date: 26 Apr 94 20:59:59 GMT
- Organization: University of Victoria
-
- G'day folks,
-
- I recently got a new toy, a PowerMac 6100 based on the Motorola/IBM/
- Apple PowerPC 601 chip. Of course, I was curious how fast it really
- was so I have done a bit of benchmarking on my own to see just what
- it can do. Some people may have been following the thread about slow
- floating point performance using sin/cos over the last week or so. This
- little test is similar to that except that it does not use sin/cos.
- Here are the results that I have seen thus far.
-
- Timing statistics for a numerically intensive computation:
-
- The code performs typical 3D shading calculations (as would be found in a 3D
- renderer such as a ray tracer or scan-line renderer) a whole bunch of times
- in a tight loop. Timings were done on a IBM RS6000 (POWERStation 375) a
- SPARC 10, a SPARC 2 GX, a PowerMac 7100 (PowerPC @ 66Mhz), a PowerMac 6100
- (PowerPC @ 60Mhz), a Quadra 840 (68040 @ 40MHz), and a NeXTstation
- (68040 @ ??Mhz).
-
- Optimization codes for CodeWarrior are:
-
- Peep == peephole optimization
- Glob == global optimization
- IS == instruction shceduling
-
- Machine Time (seconds) Compiler Optimization?
- =====================================================================
- RS6000 4.1 xlC -O2
- RS6000 4.1 xlC -O
- RS6000 4.9 xlC none
- RS6000 5.1 xlC -g
-
- SPARC 10 4.7 acc -O2 libm.il
- SPARC 10 4.9 acc -O2
- SPARC 10 4.9 acc -O
- SPARC 10 5.6 acc none
- SPARC 10 5.7 acc -g
-
- SPARC 2GX 11.6 acc -O2
- SPARC 2GX 13.9 acc none
-
- PowerMac 7100 12 CodeWarrior some??
- PowerMac 6100 16.52 CodeWarrior Peep
- PowerMac 6100 16.56 CodeWarrior Peep + Glob
- PowerMac 6100 16.43 CodeWarrior Peep + Glob + IS
- PowerMac 6100 16.15 CodeWarrior Peep + Glob + IS
- No extensions
-
- NeXTstation 32.9 gcc -O2
-
- Quadra 840 34 Symantec All
-
-
- So what does this mean??? You got me, but its interesting. A few things
- to note with the above numbers. I know a fair bit about how to get as
- much floating point grunt out of the SPARC 10 so those numbers might be
- a bit lower than they should (especially due to the use of inline functions
- for math (libm.il)). The PowerMac numbers I achieved are also worthy of
- comment. I don't know much about getting performance out of the Mac. Are
- there special libraries to link in that are faster???? Also, the
- CodeWarrior compiler I have is a Beta release and Metrowerks (the company
- that makes it) states clearly that their optimizations are
- minimal at this time. Thus no matter what optimizations I used, the
- time did not change significantly. Also, neither the PM 7100 or the PM 6100
- have a Level 2 instruction cache. This is supposed to increase the
- performance of the machine quite drastically. Anyone out there at UVic
- got a PowerMac 8100 that I can run this test on (the 8100 comes standard
- with the Level 2 cache).
-
- What else have I noticed? If you can avoid it, DO NOT use sin/cos/tan
- on the PowerMacs, their implementation is terribly slow. A similar
- test to the one above results in the PowerMac being slower than the
- Quadra 840AV. Strange, but true....
-
- Overall, I am a bit disapointed that the performance wasn't a bit closer
- to the SPARC 10 and further from the 68040 based machines. That is what
- I would have expected, but that mat be explainable by the 60Mhz clock
- on my machine and no Level 2 cache.
-
- Any comments????
-
- Brian
-
-
-
- --
- Brian Corrie (bcorrie@csr.uvic.ca)
- Under the most rigorously controlled conditions of pressure, temperature,
- volume, humidity and other variables, the organism will do as it damn well
- pleases. Sounds like some of the code I have written...... 8-)
-
- +++++++++++++++++++++++++++
-
- >From tmcgrath@netcom10.netcom.com (Timothy McGrath)
- Date: Wed, 27 Apr 1994 23:20:27 GMT
- Organization: NETCOM On-line services
-
- In article <bcorrie.767393999@tara> bcorrie@csr.UVic.CA (Brian Corrie) writes:
-
- >Machine Time (seconds) Compiler Optimization?
- >=====================================================================
- >RS6000 4.1 xlC -O2
- >RS6000 4.1 xlC -O
- >RS6000 4.9 xlC none
- >RS6000 5.1 xlC -g
- >
- >SPARC 10 4.7 acc -O2 libm.il
- >SPARC 10 4.9 acc -O2
- >SPARC 10 4.9 acc -O
- >SPARC 10 5.6 acc none
- >SPARC 10 5.7 acc -g
- >
- >SPARC 2GX 11.6 acc -O2
- >SPARC 2GX 13.9 acc none
- >
- >PowerMac 7100 12 CodeWarrior some??
- >PowerMac 6100 16.52 CodeWarrior Peep
- >PowerMac 6100 16.56 CodeWarrior Peep + Glob
- >PowerMac 6100 16.43 CodeWarrior Peep + Glob + IS
- >PowerMac 6100 16.15 CodeWarrior Peep + Glob + IS
- > No extensions
- >
- >NeXTstation 32.9 gcc -O2
- >
- >Quadra 840 34 Symantec All
- >
-
- These very interesting numeric results are showing surprisingly poor PPC
- performance in comparison to Sun and IBM RISC workstations. The results are
- at clear odds with published specmarks from IEEE Spectrum a few months ago.
-
- >So what does this mean??? You got me, but its interesting. A few things
-
- This continues a pattern that I've long observed: there seems to be
- something about the Mac that produces poor performance using standard
- compilers (MPW, Symantic, or CW). For instance, the deleted figures show
- that a 25 MHz 68040 NeXT does the computation faster than the 40Mhz 68040
- in the Quadra 840AV.
-
- I compiled POV-Ray, a popular freeware raytracer, on a 25Mhz 68040 unix box
- and compared POV-Ray's performance to my own 33Mhz 68040-based Mac
- (with cache; Symantec C 6.0). The results for such a floating-point
- intensive application: the Unix box won by being 30% faster!! (Worse still,
- yer bog $1500 486-66 runs the same app about 50% faster than the Unix box).
-
- I don't know if the problem is poor compiler optimization, poor runtime
- libraries, poor performance out of system software, or bottlenecks in the Mac
- hardware. I'm about the biggest Mac fan there is, and I'm really unhappy
- that my favorite computer is such a performance dog.
- --
- Tim McGrath ----- tmcgrath@netcom.com ----- "Minimalist signaturist"
-
- +++++++++++++++++++++++++++
-
- >From greer@utdallas.edu (Dale M. Greer)
- Date: 28 Apr 1994 03:45:38 GMT
- Organization: The University of Texas at Dallas
-
- Brian Corrie (bcorrie@csr.UVic.CA) wrote:
- > G'day folks,
-
- > Timing statistics for a numerically intensive computation:
-
- > The code performs typical 3D shading calculations (as would be found in a 3D
- > renderer such as a ray tracer or scan-line renderer) a whole bunch of times
- > in a tight loop. Timings were done on a IBM RS6000 (POWERStation 375) a
- > SPARC 10, a SPARC 2 GX, a PowerMac 7100 (PowerPC @ 66Mhz), a PowerMac 6100
- > (PowerPC @ 60Mhz), a Quadra 840 (68040 @ 40MHz), and a NeXTstation
- > (68040 @ ??Mhz).
-
- > Optimization codes for CodeWarrior are:
-
- > Peep == peephole optimization
- > Glob == global optimization
- > IS == instruction shceduling
-
- But are you using SANE on the Mac?
-
- [...]
- > What else have I noticed? If you can avoid it, DO NOT use sin/cos/tan
- > on the PowerMacs, their implementation is terribly slow. A similar
- > test to the one above results in the PowerMac being slower than the
- > Quadra 840AV. Strange, but true....
-
- Bummer! Sounds like SANE. I once wrote a floating point library for
- the 68K that had a sin/cos/tan about 10 times faster than SANE. The
- PowerMac doesn't have to be that slow. Maybe MetroWerks will tap IBM
- for a good algorithm.
-
- --
-
- Dale Greer, greer@utdallas.edu
- "They know that it is human nature to take up causes whereby a man may
- oppress his neighbor, no matter how unjustly. ... Hence they have had
- no trouble in finding men who would preach the damnability and heresy
- of the new doctrine from the very pulpit..." - Galileo Galilei, 1615
-
-
- +++++++++++++++++++++++++++
-
- >From sdoran@cis.ksu.edu (Steven D. Marcotte)
- Date: 28 Apr 94 06:29:45 GMT
- Organization: Kansas State University
-
- tmcgrath@netcom10.netcom.com (Timothy McGrath) writes:
-
- >In article <bcorrie.767393999@tara> bcorrie@csr.UVic.CA (Brian Corrie) writes:
-
- >>Machine Time (seconds) Compiler Optimization?
- >>=====================================================================
- >>RS6000 4.1 xlC -O2
- >>RS6000 4.1 xlC -O
- >>RS6000 4.9 xlC none
- >>RS6000 5.1 xlC -g
- >>
- >>SPARC 10 4.7 acc -O2 libm.il
- >>SPARC 10 4.9 acc -O2
- >>SPARC 10 4.9 acc -O
- >>SPARC 10 5.6 acc none
- >>SPARC 10 5.7 acc -g
- >>
- >>SPARC 2GX 11.6 acc -O2
- >>SPARC 2GX 13.9 acc none
- >>
- >>PowerMac 7100 12 CodeWarrior some??
- >>PowerMac 6100 16.52 CodeWarrior Peep
- >>PowerMac 6100 16.56 CodeWarrior Peep + Glob
- >>PowerMac 6100 16.43 CodeWarrior Peep + Glob + IS
- >>PowerMac 6100 16.15 CodeWarrior Peep + Glob + IS
- >> No extensions
- >>
- >>NeXTstation 32.9 gcc -O2
- >>
- >>Quadra 840 34 Symantec All
- >>
-
- >These very interesting numeric results are showing surprisingly poor PPC
- >performance in comparison to Sun and IBM RISC workstations. The results are
- >at clear odds with published specmarks from IEEE Spectrum a few months ago.
-
- >>So what does this mean??? You got me, but its interesting. A few things
-
- >This continues a pattern that I've long observed: there seems to be
- >something about the Mac that produces poor performance using standard
- >compilers (MPW, Symantic, or CW). For instance, the deleted figures show
- >that a 25 MHz 68040 NeXT does the computation faster than the 40Mhz 68040
- >in the Quadra 840AV.
-
- I may be way off here but, with Symantec C++ at least, you can
- compile a straight ANSI C program. If you do, the compiler will
- generate a window for you to do I/O with, I assume with an appropriate
- event loop. I would imagine this is where a lot of the slow down is,
- waiting for events. If you are ambitious, try porting your stuff so
- don't wait for events until all your calculations are done and see how
- that compairs.
-
- Steven
-
- --
-
- Steven Marcotte
- sdoran@cis.ksu.edu
-
- +++++++++++++++++++++++++++
-
- >From palais@binah.cc.brandeis.edu
- Date: Thu, 28 Apr 1994 13:00:21 GMT
- Organization: Brandeis University
-
- It seems to be pretty "well-known" that the reason that SANE has
- a reputation for being slow is connected mainly with a few
- transcendental functions which, to get the guaranteed accuracy
- need a lot of computation. Most of the basic routines are in fact
- quite fast. Since for most purposes SANE accuracy is overkill,
- but SANE is still a better way to go than direct FPU calls
- (for compatibility reasons---particularly with the PowerPC),
- the obvious approach is to re-write these transcendental functions
- using lower tolerances. I'm sure this is no big deal---one could
- crib the algorithms from Numerical Recipes or IMSL. But just what
- are the offending routines? I assume they are sin and cos, but does
- anyone really know?
-
- +++++++++++++++++++++++++++
-
- >From bcorrie@csr.UVic.CA (Brian Corrie)
- Date: 28 Apr 94 19:05:36 GMT
- Organization: University of Victoria
-
- tmcgrath@netcom10.netcom.com (Timothy McGrath) writes:
- >In article <bcorrie.767393999@tara> bcorrie@csr.UVic.CA (Brian Corrie) writes:
-
- >>Machine Time (seconds) Compiler Optimization?
- >>=====================================================================
- >>RS6000 4.1 xlC -O2
- >>RS6000 4.1 xlC -O
- >>RS6000 4.9 xlC none
- >>RS6000 5.1 xlC -g
- >>
- >>SPARC 10 4.7 acc -O2 libm.il
- >>SPARC 10 4.9 acc -O2
- >>SPARC 10 4.9 acc -O
- >>SPARC 10 5.6 acc none
- >>SPARC 10 5.7 acc -g
- >>
- >>SPARC 2GX 11.6 acc -O2
- >>SPARC 2GX 13.9 acc none
- >>
- >>PowerMac 7100 12 CodeWarrior some??
- >>PowerMac 6100 16.52 CodeWarrior Peep
- >>PowerMac 6100 16.56 CodeWarrior Peep + Glob
- >>PowerMac 6100 16.43 CodeWarrior Peep + Glob + IS
- >>PowerMac 6100 16.15 CodeWarrior Peep + Glob + IS
- >> No extensions
- >>
- >>NeXTstation 32.9 gcc -O2
- >>
- >>Quadra 840 34 Symantec All
- >>
-
- >These very interesting numeric results are showing surprisingly poor PPC
- >performance in comparison to Sun and IBM RISC workstations. The results are
- >at clear odds with published specmarks from IEEE Spectrum a few months ago.
-
- The processor used in the IEEE article (I assume you are talking about
- "The New Contenders", December 1993) is an 80 MHz 601. I wouldn't be
- surprised if it had a cache as well (not clear to me in the table on
- page 21). Thus this would be a similar setup to that in the 8100. I haven't
- seen a test result from such a machine yet so hopefully it will be better.
- It may turn out that with good optimizations (which CodeWarrior does not do),
- an 80MHz 601, and a level 2 cache, the PowerMac's might come close to
- the SPARC 10 as one would expect/hope. I am not ready to moan about the
- performance just yet.... 8-) I will include the code I used below
- if anyone with an 8100 wants to try it out....
-
- >>So what does this mean??? You got me, but its interesting. A few things
-
- >This continues a pattern that I've long observed: there seems to be
- >something about the Mac that produces poor performance using standard
- >compilers (MPW, Symantic, or CW). For instance, the deleted figures show
- >that a 25 MHz 68040 NeXT does the computation faster than the 40Mhz 68040
- >in the Quadra 840AV.
-
- Hopefully, the compilers will get better.... the sooner the better.
-
- >I don't know if the problem is poor compiler optimization, poor runtime
- >libraries, poor performance out of system software, or bottlenecks in the Mac
- >hardware. I'm about the biggest Mac fan there is, and I'm really unhappy
- >that my favorite computer is such a performance dog.
-
- I would say a bit of each of the above. As time goes by hopefully the
- various groups involved (Apple, Compiler types, etc.) will spend more
- time optimizing for the new machines. Libraries will improve over time.
- Hopefully the compilers will improve very quickly....
-
- Brian
-
- ======================================================================
-
-
- /* Note this is the UNIX version of the code. I used TickCount()
- on the Mac to get my timing results.
- */
-
- #include <stdio.h>
- #include <math.h>
-
- #define SL_VECDOT( A,B ) ((A)[0]*(B)[0]+(A)[1]*(B)[1]+(A)[2]*(B)[2])
- #define SL_VECLEN( A ) (sqrt((A)[0]*(A)[0]+(A)[1]*(A)[1]+(A)[2]*(A)[2]))
- #define SL_VECCROSS( A,B,C ) \
- { \
- (C)[0] = (A)[1]*(B)[2] - (A)[2]*(B)[1] ; \
- (C)[1] = (A)[2]*(B)[0] - (A)[0]*(B)[2] ; \
- (C)[2] = (A)[0]*(B)[1] - (A)[1]*(B)[0] ; \
- }
- #define SL_VECMULT( a,A,B ) \
- { \
- (B)[0]=(a)*(A)[0] ; \
- (B)[1]=(a)*(A)[1] ; \
- (B)[2]=(a)*(A)[2] ; \
- }
- #define SL_VECDIV( a,A,B ) \
- { \
- (B)[0]=(A)[0]/(a) ; \
- (B)[1]=(A)[1]/(a) ; \
- (B)[2]=(A)[2]/(a) ; \
- }
-
- #define SL_VECADD( A,B,C ) \
- { \
- (C)[0]=(A)[0]+(B)[0] ; \
- (C)[1]=(A)[1]+(B)[1] ; \
- (C)[2]=(A)[2]+(B)[2] ; \
- }
-
- #define SL_VECADDS( a,A,B,C ) \
- { \
- (C)[0] = (a) * (A)[0] + (B)[0] ; \
- (C)[1] = (a) * (A)[1] + (B)[1] ; \
- (C)[2] = (a) * (A)[2] + (B)[2] ; \
- }
-
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- register int i;
- register int MAXI;
- double N[3], L[3], Cl[3], C[3];
- double len, dot;
-
- N[0] = 1.0;
- N[1] = 2.0;
- N[2] = 3.5;
- L[0] = 1.8;
- L[1] = 0.2;
- L[2] = 1.4;
- Cl[0] = 1.5;
- Cl[1] = -0.2;
- Cl[2] = 1.9;
- C[0] = 0.0;
- C[1] = 0.0;
- C[2] = 0.0;
-
- if (argc < 2) MAXI = 1000;
- else MAXI = atoi(argv[1]);
- printf("Loop count = %d\n", MAXI);
-
- for(i=0 ; i<MAXI ; i++)
- {
- len = sqrt(SL_VECDOT(N, N));
- if (len != 0.0) SL_VECDIV(len, N, N);
-
- len = sqrt(SL_VECDOT(L, L));
- if (len != 0.0) SL_VECDIV(len, L, L);
-
- dot = SL_VECDOT(N, L);
- if (dot > 0.0) SL_VECADDS(dot, Cl, C, C);
-
- }
- printf("Color = %g, %g, %g\n", C[0], C[1], C[2]);
- }
-
-
- --
- Brian Corrie (bcorrie@csr.uvic.ca)
- Under the most rigorously controlled conditions of pressure, temperature,
- volume, humidity and other variables, the organism will do as it damn well
- pleases. Sounds like some of the code I have written...... 8-)
-
- +++++++++++++++++++++++++++
-
- >From bcorrie@csr.UVic.CA (Brian Corrie)
- Date: 28 Apr 94 19:20:05 GMT
- Organization: University of Victoria
-
- greer@utdallas.edu (Dale M. Greer) writes:
-
- >Brian Corrie (bcorrie@csr.UVic.CA) wrote:
- >> G'day folks,
-
- >> Timing statistics for a numerically intensive computation:
-
- >> The code performs typical 3D shading calculations (as would be found in a 3D
- >> renderer such as a ray tracer or scan-line renderer) a whole bunch of times
- >> in a tight loop. Timings were done on a IBM RS6000 (POWERStation 375) a
- >> SPARC 10, a SPARC 2 GX, a PowerMac 7100 (PowerPC @ 66Mhz), a PowerMac 6100
- >> (PowerPC @ 60Mhz), a Quadra 840 (68040 @ 40MHz), and a NeXTstation
- >> (68040 @ ??Mhz).
-
- >> Optimization codes for CodeWarrior are:
-
- >> Peep == peephole optimization
- >> Glob == global optimization
- >> IS == instruction shceduling
-
- >But are you using SANE on the Mac?
-
- Not as far as I know. Just doing multiplies, adds, divisions, and one sqrt
- per iteration through the loop. I posted the code in response to another
- article in this thread if anyone is interested.
-
- Brian
- --
- Brian Corrie (bcorrie@csr.uvic.ca)
- Under the most rigorously controlled conditions of pressure, temperature,
- volume, humidity and other variables, the organism will do as it damn well
- pleases. Sounds like some of the code I have written...... 8-)
-
- +++++++++++++++++++++++++++
-
- >From nagle@netcom.com (John Nagle)
- Date: Thu, 28 Apr 1994 19:19:56 GMT
- Organization: NETCOM On-line Communication Services (408 241-9760 guest)
-
- palais@binah.cc.brandeis.edu writes:
- >It seems to be pretty "well-known" that the reason that SANE has
- >a reputation for being slow is connected mainly with a few
- >transcendental functions which, to get the guaranteed accuracy
- >need a lot of computation. Most of the basic routines are in fact
- >quite fast. Since for most purposes SANE accuracy is overkill,
- >but SANE is still a better way to go than direct FPU calls
- >(for compatibility reasons---particularly with the PowerPC),
-
- Nah. You're guaranteed that an FPU is present on PPC, so use it.
- Worse, "double" using SANE is 80 bits, and the PPC has only 64-bit
- floating point hardware, which makes 80-bit floating point expensive.
-
- SANE is slow because you spend so much time pushing big floating
- point objects on the stack and taking them off the stack. You lose
- a factor of 10 with SANE on 68K macs equipped with FPUs for multiply.
-
- John Nagle
-
- +++++++++++++++++++++++++++
-
- >From bcorrie@csr.UVic.CA (Brian Corrie)
- Date: 28 Apr 94 23:35:40 GMT
- Organization: University of Victoria
-
- sdoran@cis.ksu.edu (Steven D. Marcotte) writes:
- >tmcgrath@netcom10.netcom.com (Timothy McGrath) writes:
- >>In article <bcorrie.767393999@tara> bcorrie@csr.UVic.CA (Brian Corrie) writes:
- [Bunch of stats deleted]
- >>These very interesting numeric results are showing surprisingly poor PPC
- >>performance in comparison to Sun and IBM RISC workstations. The results are
- >>at clear odds with published specmarks from IEEE Spectrum a few months ago.
-
- >>>So what does this mean??? You got me, but its interesting. A few things
-
- >>This continues a pattern that I've long observed: there seems to be
- >>something about the Mac that produces poor performance using standard
- >>compilers (MPW, Symantic, or CW). For instance, the deleted figures show
- >>that a 25 MHz 68040 NeXT does the computation faster than the 40Mhz 68040
- >>in the Quadra 840AV.
-
- > I may be way off here but, with Symantec C++ at least, you can
- >compile a straight ANSI C program. If you do, the compiler will
- >generate a window for you to do I/O with, I assume with an appropriate
- >event loop. I would imagine this is where a lot of the slow down is,
- >waiting for events. If you are ambitious, try porting your stuff so
- >don't wait for events until all your calculations are done and see how
- >that compairs.
-
- With CodeWarrior, you get a IO window, but as far as I know there is
- no event loop, the benchmark program is in total control of the machine
- (at least it control mine, short of forcing it to quit). I don't
- think that is the source of much of the slow down anyway. Of course
- I am no expert and may be completely out to lunch 8-)
-
- Brian
- --
- Brian Corrie (bcorrie@csr.uvic.ca)
- Under the most rigorously controlled conditions of pressure, temperature,
- volume, humidity and other variables, the organism will do as it damn well
- pleases. Sounds like some of the code I have written...... 8-)
-
- +++++++++++++++++++++++++++
-
- >From bcorrie@csr.UVic.CA (Brian Corrie)
- Date: 28 Apr 94 23:39:19 GMT
- Organization: University of Victoria
-
- palais@binah.cc.brandeis.edu writes:
- >It seems to be pretty "well-known" that the reason that SANE has
- >a reputation for being slow is connected mainly with a few
- >transcendental functions which, to get the guaranteed accuracy
- >need a lot of computation. Most of the basic routines are in fact
- >quite fast. Since for most purposes SANE accuracy is overkill,
- >but SANE is still a better way to go than direct FPU calls
- >(for compatibility reasons---particularly with the PowerPC),
- >the obvious approach is to re-write these transcendental functions
- >using lower tolerances. I'm sure this is no big deal---one could
- >crib the algorithms from Numerical Recipes or IMSL. But just what
- >are the offending routines? I assume they are sin and cos, but does
- >anyone really know?
-
- So maybe someone can tell me. If I use CodeWarrior, include the ANSI
- library and the MathLibrary, am I using SANE????? I don't think I am,
- but I may be wrong!?!?
-
- My experiences thus far show that a computation that uses all sin/cos
- calls is HORRIBLY slow on the PowerMacs. Slower even than a Quadra 840.
- And yes, that is native PowerMac code. Obviously the sin/cos implementation
- is faster on the Quadra. Is it a hardware calculation on the Quadra's
- floating point unit, or is it less accurate on the Quadra? You got me,
- but I know its slow on the PowerMac!!
-
- Brian
-
-
- --
- Brian Corrie (bcorrie@csr.uvic.ca)
- Under the most rigorously controlled conditions of pressure, temperature,
- volume, humidity and other variables, the organism will do as it damn well
- pleases. Sounds like some of the code I have written...... 8-)
-
- +++++++++++++++++++++++++++
-
- >From nagle@netcom.com (John Nagle)
- Date: Fri, 29 Apr 1994 02:09:29 GMT
- Organization: NETCOM On-line Communication Services (408 241-9760 guest)
-
- bcorrie@csr.UVic.CA (Brian Corrie) answers the question:
- >>But are you using SANE on the Mac?
-
- >Not as far as I know. Just doing multiplies, adds, divisions, and one sqrt
- >per iteration through the loop. I posted the code in response to another
- >article in this thread if anyone is interested.
-
- Try using 8-byte doubles and see if things improve. PPC doesn't have
- an 80-bit FPU, so 80-bit performance suffers. Or try using "float" instead
- of "double", which consistently gets you 32-bit floats on all Apple
- platforms.
-
- John Nagle
-
- +++++++++++++++++++++++++++
-
- >From 103t_english@west.cscwc.pima.edu
- Date: 29 Apr 94 03:09:48 MST
- Organization: (none)
-
- In article <1994Apr28.130021.22832@news.cs.brandeis.edu>, palais@binah.cc.brandeis.edu writes:
- > It seems to be pretty "well-known" that the reason that SANE has
- > a reputation for being slow is connected mainly with a few
- > transcendental functions which, to get the guaranteed accuracy
- > need a lot of computation. Most of the basic routines are in fact
- > quite fast. Since for most purposes SANE accuracy is overkill,
- > but SANE is still a better way to go than direct FPU calls
- > (for compatibility reasons---particularly with the PowerPC),
- > the obvious approach is to re-write these transcendental functions
- > using lower tolerances. I'm sure this is no big deal---one could
- > crib the algorithms from Numerical Recipes or IMSL. But just what
- > are the offending routines? I assume they are sin and cos, but does
- > anyone really know?
-
-
- IF the FPU is present on a 68K Mac, the SANE calls will use it, but only for
- arithmetic. All other SANE calls are done using Apple's own libraries (using
- the fpu for addition/subtraction/etc).
-
- The overhead from SANE also comes from the fact that it is called via the Trap
- Dispatcher, instead of directly, and that translations between the SANE format
- and the 68881 format need to be done.
-
-
- Lawson
-
- +++++++++++++++++++++++++++
-
- >From sparent@mv.us.adobe.com (Sean Parent)
- Date: Sat, 30 Apr 1994 00:02:02 GMT
- Organization: Adobe Systems Incorporated
-
- This is getting awfully messy. The original discussion was talking about
- native floating point performance. Some how the question of SANE came up.
- Let me list some info:
-
- % On 68K machines w/o an FPU, SANE is a software floating point package
- implemented using integer arithmetic and provides 80bit "extended" floating
- point support. For most (all) operations, floating point types (whether
- double, single, comp, etc.) promote to 80 bit extendes for maximal
- accuracy. Hence, using 80 bit extendeds tends to be fastest. SANE is
- invoked via an A-Trap but in recent systems SANE back pages the calling
- code so the A-Trap overhead is only paid on the first invocation.
-
- % On 68K machines w/ an FPU, SANE is still available and is implement using
- the FPU for those operations that it can and maintain accuracy. The FPU
- (68881/2 or 040) uses 96bit format but 16 bits are unused so converting
- from 80bit to 96 bit format only requires a shift. Applications can be
- compiled to call the FPU directly and they can check for it via a call to
- Gestalt. On the 040, the transcendental functions are not in the FPU so
- those instructions are handled in software as exceptions.
-
- % On a Power Mac, running emulated code, there is no emulated FPU so it is
- similar to the first case above except SANE is build into the emulator so
- it is running "native" (though it still only uses integer math to do the fp
- calculations). There is no "Mixed Mode" overhead or A-Trap dispatch
- overhead because SANE is handled as any other instructions (there really
- isn't any "A-Trap" overhead at all on the Power Mac because the A-Trap
- dispatching is handled by the emulator).
-
- % On a Power Mac, running a "native" application SANE is not available. You
- can't do native 80 or 96bit arithmetic (unless you wan't to implement it
- yourself or call some 68K code to do it). Instead, there is a new numerics
- package based on the NCEG spec. It support most all of what SANE did
- (though a couple of types are missing, like comp) and a bit more. The
- supported types are: float (IEEE single), double (IEEE double), and long
- double (IBM's "double double" which is 128bits and is IEEE extended
- complient).
-
- A portable application should use floats or doubles for persistent data
- storage (files), float_t or double_t for fast calculations with precision
- and least that of float and double respectively, and long double for
- intermediate results that require extra precision. On the various machines,
- these types are:
-
- 68K SANE 68K FPU PowerPC
- float 32bit 32bit 32bit
- double 64bit 64bit 64bit
- float_t 80bit 96bit 32bit
- double_t 80bit 96bit 64bit
- long double 80bit 96bit 128bit
-
- Now, I haven't looked at this bench mark that is floating around that shows
- native PPC applications in such bad light but what could attribute to it is
- the compiler (I don't know of a PPC compiler other than xlc that does
- really good FP optimizations), and the floating point library. Last I
- checked Apple's library was a bit slower than IBM's though it was
- considerably more accurate. Someone with some time should compiler the
- "bench mark" with xlc and run it on a PowerMac and time the library
- routines. I know of no reason why there would be any significant difference
- in time between a 66MHz PowerMac and a 66MHz 250 given the same compiler
- and the same libraries.
-
- --
- Sean Parent
-
- +++++++++++++++++++++++++++
-
- >From rang@winternet.mpls.mn.us (Anton Rang)
- Date: 29 Apr 1994 23:08:18 GMT
- Organization: Minnesota Angsters
-
- In article <bcorrie.767576359@tara> bcorrie@csr.UVic.CA (Brian Corrie) writes:
- >So maybe someone can tell me. If I use CodeWarrior, include the ANSI
- >library and the MathLibrary, am I using SANE????? I don't think I am,
- >but I may be wrong!?!?
-
- No, you're not using SANE, unless you're compiling for the 68000.
- SANE is only used on the 68000 series. It's not available on the
- Power Macintoshes except in emulation mode.
-
- >My experiences thus far show that a computation that uses all sin/cos
- >calls is HORRIBLY slow on the PowerMacs. Slower even than a Quadra 840.
-
- Right. The transcendental functions are sloooooow. I don't know
- how much of this is related to supporting the NCEG exception model,
- but I suspect an awful lot of is. (Alternatively, it could be that
- range reduction is implemented poorly?)
-
- After all, to a first approximation, computing a sin requires:
-
- (i) Range-reduce to (say) 0 to pi/2.
- This may require a division (slow) if you're out of the range
- -pi to +pi, but shouldn't be *that* incredibly slow.
-
- (ii) Compute a Taylor series (or a more quickly converging one).
- I'm not sure how many terms would be required, not being up
- on state-of-the-art numerical algorithms, but probably not
- more than 5 or so for single precision, perhaps 8-10 for
- double precision. These should be multiply-add, relatively
- fast.
-
- (iii) Do a little cleanup depending on the original sign etc.
-
- >Is it a hardware calculation on the Quadra's
- >floating point unit, or is it less accurate on the Quadra?
-
- Neither, as far as I know (not sure about accuracy). The 68040
- doesn't have built-in transcendental functions; they're implemented in
- software. Heck, I've been tempted to disassemble the 68040 FPSP, grab
- the appropriate constants, port it to PPC assembly and time the
- result. It would be *bound* to be faster than the current one.
-
- SOMEONE out there must know the story about why MathLib runs so
- slowly. Is it the exception handling? There are a bunch of procedure
- calls in it related to that, and handling all of the boundaries right
- undoubtedly requires a lot of work...sigh. Wish I knew for sure.
- --
- Anton Rang (rang@winternet.mpls.mn.us)
-
- +++++++++++++++++++++++++++
-
- >From jwbaxter@olympus.net (John W. Baxter)
- Date: Sun, 01 May 1994 10:32:08 -0700
- Organization: Internet for the Olympic Peninsula
-
- In article <TMCGRATH.94Apr27162028@netcom10.netcom.com>,
- tmcgrath@netcom10.netcom.com (Timothy McGrath) wrote:
-
- [Table of results omitted...it's been quoted many times already.]
- >
- > These very interesting numeric results are showing surprisingly poor PPC
- > performance in comparison to Sun and IBM RISC workstations. The results are
- > at clear odds with published specmarks from IEEE Spectrum a few months ago.
- >
- No...take a look at the improvements for the 6100 as additional
- optimizations are added. Notice that essentially there aren't any
- improvements.
-
- What is being compared is optimized code (I suspect, but don't have access
- to the compilers on the other systems compared) versus essentially
- unoptimized code. With the added complication that different hardware is
- running the optimized code.
-
-
- > >So what does this mean???
-
- It means that CodeWarrior isn't finished. There are easier ways to learn
- this astounding fact, such as by looking at the version number.
-
- ****Someone who has the means:
- Could we run the code in question through the xlc compiler, move it to
- the Mac, and time it?
-
- [Given the code, I could now do that for the MPW compiler, which is
- said to lie between xlc and CodeWarrior in current quality...closer to the
- former.]
- --
- John Baxter Port Ludlow, WA, USA [West shore, Puget Sound]
- jwbaxter@pt.olympus.net
-
- +++++++++++++++++++++++++++
-
- >From John Brewer <jbrewer@wri.com>
- Date: Tue, 3 May 1994 03:11:15 GMT
- Organization: Wolfram Research, Inc.
-
- In article <bcorrie.767393999@tara> Brian Corrie, bcorrie@csr.UVic.CA writes:
- >The code performs typical 3D shading calculations (as would be found in a 3D
- >renderer such as a ray tracer or scan-line renderer) a whole bunch of times
- >in a tight loop. Timings were done on a IBM RS6000 (POWERStation 375) a
- >SPARC 10, a SPARC 2 GX, a PowerMac 7100 (PowerPC @ 66Mhz), a PowerMac 6100
- >(PowerPC @ 60Mhz), a Quadra 840 (68040 @ 40MHz), and a NeXTstation
- >(68040 @ ??Mhz).
-
- It'd be interresting to try using xlc to generate the PowerMac code.
- It seems to be the best at optimization, although it can easily take up to
- 100 Mb of swap space to compile a large program.
-
- John Brewer
- Wolfram Research, Inc.
- (but speaking for myself)
-
- +++++++++++++++++++++++++++
-
- >From uzun@crash.cts.com (Roger Uzun)
- Date: Tue, 3 May 1994 17:03:00 GMT
- Organization: CTS Network Services (CTSNET/crash), San Diego, CA
-
- I have this 3D shading code, the tight loop benchmark that
- was circulating around here, but I do not know how
- many loops were performed to get the results that
- were posted was it 1,000,000?
- The default is 1000 and this executes in less than a second
- on all machines around here (040, pentiums, no macs).
- How many iterations were used in the running of this benchmark?
- Also could someone repost any results people came up with.
-
- -Roger
- - ------------------------------------------------------------
- bix: ruzun
- NET: uzun@crash.cts.com
-
- +++++++++++++++++++++++++++
-
- >From bcorrie@csr.UVic.CA (Brian Corrie)
- Date: 3 May 94 23:47:51 GMT
- Organization: University of Victoria
-
- uzun@crash.cts.com (Roger Uzun) writes:
- >I have this 3D shading code, the tight loop benchmark that
- >was circulating around here, but I do not know how
- >many loops were performed to get the results that
- >were posted was it 1,000,000?
- >The default is 1000 and this executes in less than a second
- >on all machines around here (040, pentiums, no macs).
- >How many iterations were used in the running of this benchmark?
- >Also could someone repost any results people came up with.
-
- Oppps, Sorry about that. Yes, 1,000,000 is the correct magic
- number to produce the same results that I got. Please post any
- results that you get....
-
- Cheers,
-
- Brian
-
- --
- Brian Corrie (bcorrie@csr.uvic.ca)
- Under the most rigorously controlled conditions of pressure, temperature,
- volume, humidity and other variables, the organism will do as it damn well
- pleases. Sounds like some of the code I have written...... 8-)
-
- +++++++++++++++++++++++++++
-
- >From oliver@psy.fsu.edu (Bill Oliver)
- Date: 4 May 1994 14:14:33 GMT
- Organization: FSU Psych Dept
-
- In article <bcorrie.768008871@tara>
- bcorrie@csr.UVic.CA (Brian Corrie) writes:
-
- > uzun@crash.cts.com (Roger Uzun) writes:
- > >I have this 3D shading code, the tight loop benchmark that
- > >was circulating around here, but I do not know how
- > >many loops were performed to get the results that
- > >were posted was it 1,000,000?
- > >The default is 1000 and this executes in less than a second
- > >on all machines around here (040, pentiums, no macs).
- > >How many iterations were used in the running of this benchmark?
- > >Also could someone repost any results people came up with.
- >
- > Oppps, Sorry about that. Yes, 1,000,000 is the correct magic
- > number to produce the same results that I got. Please post any
- > results that you get....
- >
- > Cheers,
- >
- > Brian
-
-
-
- Your code is taking approximately 35 seconds to run on my Centris
- 660AV. The compiler I'm using is Metrowerks CW C (68020&6881 Codegen, 4
- Byte Ints, Peephole & CSE optimizers). I'm quite happy with this result
- given the other times that were posted (I'm reposting those below). I
- think I'll wait on the PowerMac :-)
-
- -Bill-
-
- >>Machine Time (seconds) Compiler Optimization?
- >>=====================================================================
- >>RS6000 4.1 xlC -O2
- >>RS6000 4.1 xlC -O
- >>RS6000 4.9 xlC none
- >>RS6000 5.1 xlC -g
- >>
- >>SPARC 10 4.7 acc -O2 libm.il
- >>SPARC 10 4.9 acc -O2
- >>SPARC 10 4.9 acc -O
- >>SPARC 10 5.6 acc none
- >>SPARC 10 5.7 acc -g
- >>
- >>SPARC 2GX 11.6 acc -O2
- >>SPARC 2GX 13.9 acc none
- >>
- >>PowerMac 7100 12 CodeWarrior some??
- >>PowerMac 6100 16.52 CodeWarrior Peep
- >>PowerMac 6100 16.56 CodeWarrior Peep + Glob
- >>PowerMac 6100 16.43 CodeWarrior Peep + Glob
- + IS
- >>PowerMac 6100 16.15 CodeWarrior Peep + Glob
- + IS
- >> No extensions
- >>
- >>NeXTstation 32.9 gcc -O2
- >>
- >>Quadra 840 34 SymantecAll
-
- +++++++++++++++++++++++++++
-
- >From Dave Falkenburg <falken@apple.com>
- Date: Fri, 29 Apr 1994 08:00:16 GMT
- Organization: Apple Computer, Inc.
-
- In article <TMCGRATH.94Apr27162028@netcom10.netcom.com> Timothy McGrath,
- tmcgrath@netcom10.netcom.com writes:
- >I compiled POV-Ray, a popular freeware raytracer, on a 25Mhz 68040 unix
- box
- >and compared POV-Ray's performance to my own 33Mhz 68040-based Mac
- >(with cache; Symantec C 6.0). The results for such a floating-point
- >intensive application: the Unix box won by being 30% faster!! (Worse
- still,
- >yer bog $1500 486-66 runs the same app about 50% faster than the Unix
- box).
-
- Are you running the version that calls SetCPixel for every pixel to be
- rendered?
- My brother recompiled POV a couple of months ago and got barn-burning
- performance out of it.
-
- The Mac-specific stuff in the version you have might be a complete dog.
-
- >I don't know if the problem is poor compiler optimization, poor runtime
- >libraries, poor performance out of system software, or bottlenecks in
- the Mac
- >hardware. I'm about the biggest Mac fan there is, and I'm really unhappy
- >that my favorite computer is such a performance dog.
-
- Remember that CW isn't final yet AND this version will not be as good as
- xlc on AIX, or PPCC in the PowerMac SDK.
-
- One big hog is mathlib--> the AIX libm.a is MUCH faster than one in ROM
- Apple is shipping today-- it's hand tuned code for calculating sin, cos,
- etc.
-
-
- If I were a developer, I'd scream at the top of my lungs at the WWDC
- about this...
-
-
- -Dave Falkenburg
- -Not speaking for "Apple Computer, Inc." in this posting
-
- ---------------------------
-
- >From rcohen@ssl.umd.edu (Rob Cohen)
- Subject: Saving the floating Point Registers
- Date: 26 Apr 1994 20:43:17 GMT
- Organization: Space Systems Laboratory, University of Maryland
-
- I've written an interrupt service routine that when called does some
- floating point math. There is also a lot of floating point math that
- goes on in the rest of the code. Unfortunately, my code crashes when
- I'm running the ISR in places that do math. I think the problem is
- that I'm not preserving the values in the floating point registers. I
- think I want to push them on the stack when I enter the ISR, do what I
- have to do and then pop them off. My question then becomes how do you
- do this. I know the locations of the floating point register,
- FP0...FP7, but what does the assembler look like to do this.
-
- Thanks
-
- - -----------------------------------------------------------------
- Rob Cohen rcohen@ssl.umd.edu
-
- The views expressed here are my own Blah, blah, blah, blah (The
- standard disclaimer)
-
- +++++++++++++++++++++++++++
-
- >From Ron_Hunsinger@bmug.org (Ron Hunsinger)
- Date: Sun, 1 May 94 23:38:47 PST
- Organization: Berkeley Macintosh Users Group
-
- rcohen@ssl.umd.edu (Rob Cohen) writes:
-
- >I've written an interrupt service routine that when called does some
- >floating point math. There is also a lot of floating point math that
- >goes on in the rest of the code. Unfortunately, my code crashes when
- >I'm running the ISR in places that do math. I think the problem is
- >that I'm not preserving the values in the floating point registers. I
- >think I want to push them on the stack when I enter the ISR, do what I
- >have to do and then pop them off. My question then becomes how do you
- >do this. I know the locations of the floating point register,
- >FP0...FP7, but what does the assembler look like to do this.
-
- It's not just the registers that have to be saved. You have to save
- the state of the FPU also, since you could have interrupted it in the
- middle of an operation. In general, you have to:
-
- FSAVE <ea> ; save the non-visible state
- FMOVEM.L FPCR/FPSR/FPIAR, <ea> ; save the control registers
- FMOVEM.X FP0-FP7, <ea> ; save the data registers
-
- ; establish the environment you want to run in
- ; (rounding rules, traps, etc) because the task you
- ; interrupted may have changed them. A quick way to
- ; reset the fpu is to do an FRESTORE from a longword
- ; containing $00000000, but this clears ALL the registers
- ; so you can't have skimped on any of the above register-
- ; saving.
-
- ; do your work
-
- FMOVEM.X <ea>, FP0-FP7 ; restore the data registers
- FMOVEM.L <ea>, FPCR/FPSR/FPIAR ; restore the control registers
- FRESTORE <ea> ; restore the non-visible state
-
- All of this saving and restoring is not guaranteed to be cheap, which
- is why it wasn't done automatically for you.
-
- -Ron Hunsinger
-
- ---------------------------
-
- >From Daniel Jibouleau <jiboule@hermes.ulaval.ca>
- Subject: The NewWindow case
- Date: Thu, 28 Apr 1994 23:19:08 GMT
- Organization: Universit Laval
-
- For a long time now, i am still asking myself whether it is better to
- call NewWindow (or GetNewWindow) with a storage or to let it allocate
- it's storage itself. Note that both ways may be correct. Consider the
- following example:
-
- NewWindow with a storage:
-
- {
- WindowPtr theWindow;
- WindowRecord windStorage;
-
- /* Use a pointer to our storage to store the window associated
- information. It will be stored on the stack, thus reducing heap
- fragmentation. */
- theWindow = GetNewWindow (&windStorage, fooWindID, (WindowPtr) -1L);
- }
-
- NewWindow without storage:
-
- {
- WindowPtr theWindow;
-
- /* Let the Window Manager allocate the storage for the window itself.
- It will be placed on the heap, thus increasing chances of heap
- fragmentation. The Window Manager may be doing this in a better way,
- tough. */
- theWindow = GetNewWindow (nil, fooWindID, (WindowPtr) -1L);
- }
-
-
- Daniel Jibouleau
- jiboule@hermes.ulaval.ca
-
- +++++++++++++++++++++++++++
-
- >From rmah@panix.com (Robert S. Mah)
- Date: Fri, 29 Apr 1994 10:16:54 -0500
- Organization: One Step Beyond
-
- Daniel Jibouleau <jiboule@hermes.ulaval.ca> wrote:
-
- > For a long time now, i am still asking myself whether it is better to
- > call NewWindow (or GetNewWindow) with a storage or to let it allocate
- > it's storage itself. Note that both ways may be correct. Consider the
- > following example:
- >
- > NewWindow with a storage:
- >
- > {
- > WindowPtr theWindow;
- > WindowRecord windStorage;
- >
- > /* Use a pointer to our storage to store the window associated
- > information. It will be stored on the stack, thus reducing heap
- > fragmentation. */
- > theWindow = GetNewWindow (&windStorage, fooWindID, (WindowPtr) -1L);
- > }
- >
- > NewWindow without storage:
- >
- > {
- > WindowPtr theWindow;
- >
- > /* Let the Window Manager allocate the storage for the window itself.
- > It will be placed on the heap, thus increasing chances of heap
- > fragmentation. The Window Manager may be doing this in a better way,
- > tough. */
- > theWindow = GetNewWindow (nil, fooWindID, (WindowPtr) -1L);
- > }
-
- The first example is very, very dangerous. Since the storage is a local
- variable, and allocated on the stack, it goes away after the function
- is exited. This is fine if that function is main(), but not the other
- way around. Better to use a global (or static) if you care about heap
- fragging.
-
- My rule of thumb is to use static/global (stack based) allocation for
- window storage only if the app only uses a small, fairly constant set
- of windows. For apps with user-created documents, static allocation
- is not such a good thing because it would limit the # of docs the user
- could open.
-
- Cheers,
- Rob
- ___________________________________________________________________________
- Robert S. Mah -=- One Step Beyond -=- 212-947-6507 -=- rmah@panix.com
-
- +++++++++++++++++++++++++++
-
- >From dean@genmagic.com (Dean Yu)
- Date: 29 Apr 1994 17:57:56 GMT
- Organization: General Magic, Inc.
-
- In article <Cozsrx.6Kp@athena.ulaval.ca>, Daniel Jibouleau
- <jiboule@hermes.ulaval.ca> wrote:
- > For a long time now, i am still asking myself whether it is better to
- > call NewWindow (or GetNewWindow) with a storage or to let it allocate
- > it's storage itself. Note that both ways may be correct. Consider the
- > following example:
-
- Although allocating the storage space for the window record yourself
- might help your memory management now, it might be a hindrance in the
- future. If Apple ever goes to a protected memory model, it would almost
- definitely be better if the toolbox would be able to allocate its data
- structures in another address space and pass you a reference to that data
- structure. If everyone specified nil as the wStorage parameter now, it
- would be much much simpler for a future Window Manager to change while
- still maintaining API compatibility. But because storage can be allocated
- by the application, it makes moving forward while still maintaining
- compatibility much more difficult.
- I've gone on tirades about this topic before; it was something I really
- wanted to do at Apple, but never had the time for. :/
-
- -- Dean Yu
- Negative Ethnic Role Model
- General Magic, Inc.
-
- ---------------------------
-
- >From ereidell@media.mit.edu (Evan A. Reidell)
- Subject: Truetype font format specification: No longer available from Apple ?!
- Date: Mon, 25 Apr 1994 19:57:29 GMT
- Organization: MIT Media Laboratory
-
- I have been having a hell of a time trying to find
- the Apple TrueType font format specification.
-
- Luckily, this is _theoretically_ available
- as "Apple Finished Goods" product number:
- M0825 LL/A ``TrueType font format specification''
-
- Unluckily, no one at ALL seems to know anything about it.
-
- I've been bounced around between Catalog Sales, Apple Authorized Dealers,
- AP.D.A, Apple Customer Assistance, and Apple R&D groups so many times
- that I'm beginning to wonder if the TrueType font format even exists.
-
- Is it worth the grief?? Or is Adobe PostScript the way to go,
- no matter how Apple and Microsoft would like to play their games?
-
- Can anyone out there help me get my hands on this "document" ?
-
- -- evan reidell
-
- +++++++++++++++++++++++++++
-
- >From s66039@cc.ntnu.edu.tw (Riboflavin)
- Date: Tue, 26 Apr 1994 09:54:40 GMT
- Organization: NTNU, Taiwan, R.O.C.
-
- Evan A. Reidell (ereidell@media.mit.edu) wrote:
- : I have been having a hell of a time trying to find
- : the Apple TrueType font format specification.
- : Unluckily, no one at ALL seems to know anything about it.
- : I've been bounced around between Catalog Sales, Apple Authorized Dealers,
- : AP.D.A, Apple Customer Assistance, and Apple R&D groups so many times
- : that I'm beginning to wonder if the TrueType font format even exists.
- : Is it worth the grief?? Or is Adobe PostScript the way to go,
- : no matter how Apple and Microsoft would like to play their games?
-
- I don't know, I had an heck of a time getting a particular document from
- Adobe a while back, but they finally came through. As for the TrueType spec.,
- forget Apple. Instead, ftp to ftp.microsoft.com and look for it - it's there!
- Only catch is it comes either as a Windows help file, or as a PC Word 2.0
- file, the latter of which you should be able to load into your Mac version
- of Word.
-
- -Steven Fox-
-
-
- +++++++++++++++++++++++++++
-
- >From tkr@puffball.demon.co.uk (Tim Rylance)
- Date: Tue, 26 Apr 1994 11:45:10 +0000
- Organization: Tim Rylance, Bath, UK
-
- s66039@cc.ntnu.edu.tw (Riboflavin) writes:
-
- >I don't know, I had an heck of a time getting a particular document from
- >Adobe a while back, but they finally came through. As for the TrueType spec.,
- >forget Apple. Instead, ftp to ftp.microsoft.com and look for it - it's there!
- >Only catch is it comes either as a Windows help file, or as a PC Word 2.0
- >file, the latter of which you should be able to load into your Mac version
- >of Word.
-
- There's a Postscript version at
-
- ftp.icce.rug.nl:pub/erikjan/truetype/ttspec/*.ps
-
- --
- Tim Rylance <tkr@puffball.demon.co.uk>
-
- +++++++++++++++++++++++++++
-
- >From vens007@telecom.ptt.nl (Erik-Jan Vens,HD,)
- Date: 26 Apr 1994 11:53:04 +0200
- Organization: PTT Telecom B.V. The Netherlands
-
- dixit ereidell@media.mit.edu (Evan A. Reidell) in <1994Apr25.195729.2855@news.media.mit.edu>:
- >I have been having a hell of a time trying to find
- >the Apple TrueType font format specification.
- >
- >Luckily, this is _theoretically_ available
- >as "Apple Finished Goods" product number:
- >M0825 LL/A ``TrueType font format specification''
-
- Supposedly the TrueType format should be the same for DOS and Apple.
- Maybe you should try ftp.icce.rug.nl in pub/erikjan/truetype/ttspec. I
- have converted the MS version to Postscript.
-
- EJee
-
- --
- - -----------------------------------------------------------------------------
- Erik-Jan Vens | Telephone: +31 50 855994
- PTT Telecom BV | Telefax : +31 50 855777
- I&AT | E-mail : vens007@telecom.ptt.nl
- P.O. Box 188 | DISCLAIMER: This statement is not an official
- NL-9700 AD Groningen | statement from, nor does it represent an
- The Netherlands | official position of, PTT Telecom B.V.
- - -----------------------------------------------------------------------------
-
- +++++++++++++++++++++++++++
-
- >From pan@vaxc.cc.monash.edu.au (Pan Thongvilu)
- Date: 27 Apr 1994 02:34:50 GMT
- Organization: Monash University
-
- In article <1994Apr26.095440.19400@cc.ntnu.edu.tw>, s66039@cc.ntnu.edu.tw (Riboflavin) writes:
- |> Evan A. Reidell (ereidell@media.mit.edu) wrote:
- |> : I have been having a hell of a time trying to find
- |> : the Apple TrueType font format specification.
- |> : Unluckily, no one at ALL seems to know anything about it.
- |> : I've been bounced around between Catalog Sales, Apple Authorized Dealers,
- |> : AP.D.A, Apple Customer Assistance, and Apple R&D groups so many times
- |> : that I'm beginning to wonder if the TrueType font format even exists.
- |> : Is it worth the grief?? Or is Adobe PostScript the way to go,
- |> : no matter how Apple and Microsoft would like to play their games?
- |>
- |> I don't know, I had an heck of a time getting a particular document from
- |> Adobe a while back, but they finally came through. As for the TrueType spec.,
- |> forget Apple. Instead, ftp to ftp.microsoft.com and look for it - it's there!
- |> Only catch is it comes either as a Windows help file, or as a PC Word 2.0
- |> file, the latter of which you should be able to load into your Mac version
- |> of Word.
- |>
- |> -Steven Fox-
- |>
- Hi,
-
- I went to ftp.microsoft.com a couple of times. I looked and looked
- but could not find it.
-
- Can someone tell us where to find it on the tree and what it is
- called so I can do an 'archie -c' on it.
-
- Thanks,
- Pan.
-
- +++++++++++++++++++++++++++
-
- >From dmunsil@netcom.com (Don Munsil)
- Date: Wed, 27 Apr 1994 16:48:08 GMT
- Organization: The Munsil/Stone Organization
-
- Pan Thongvilu (pan@vaxc.cc.monash.edu.au) wrote:
- : In article <1994Apr26.095440.19400@cc.ntnu.edu.tw>, s66039@cc.ntnu.edu.tw (Riboflavin) writes:
- : |> Evan A. Reidell (ereidell@media.mit.edu) wrote:
- : |> : I have been having a hell of a time trying to find
- : |> : the Apple TrueType font format specification.
-
- : I went to ftp.microsoft.com a couple of times. I looked and looked
- : but could not find it.
-
- It's in about the most un-intuitive place imaginable -- I believe it's
-
- /developer/drg/Truetype-Info
-
- There are a lot of documents in there. Beware! The Word for Windows
- document is not as up-to-date as the most recent printed version. The
- WinHelp file appears to be about the same as the printed version. There
- are problems and errors in the 1.00 version, so be careful.
-
- --Don
- --
- - ----------------------------------------------------
- Don Munsil | I respect faith, but doubt is
- dmunsil@netcom.com | what gets you an education.
- don@elseware.com | -- Wilson Mizner
-
- +++++++++++++++++++++++++++
-
- >From zune@lysator.liu.se (Andreas Magnusson)
- Date: 29 Apr 1994 10:42:13 GMT
- Organization: (none)
-
- dmunsil@netcom.com (Don Munsil) writes:
-
- >Pan Thongvilu (pan@vaxc.cc.monash.edu.au) wrote:
-
- >It's in about the most un-intuitive place imaginable -- I believe it's
-
- >/developer/drg/Truetype-Info
-
- >There are a lot of documents in there. Beware! The Word for Windows
- >document is not as up-to-date as the most recent printed version. The
- >WinHelp file appears to be about the same as the printed version. There
- >are problems and errors in the 1.00 version, so be careful.
-
- >--Don
- >--
- >------------------------------------------------------
- >Don Munsil | I respect faith, but doubt is
- >dmunsil@netcom.com | what gets you an education.
- >don@elseware.com | -- Wilson Mizner
-
- While we're at it, can somebody tell me if the Apple docs are better, or
- at least more readable than the Microsoft docs.
- It's a personal taste, but I can't for my life understand the MS-docs.
- All there are is a listing of all the instructions, and how they supposedly
- work, but no examples or tips or tricks. It's a shame since the Adobe
- docs for Type 1 (which isn't as complex, I know) is full of examples that
- enables me to fully decode, understand and even hand code changes in a font.
- Especially since they say that it's meant to put the intelligence in the
- font instead of in the rasterizer.
-
- Is there any examples at all available for TrueType?
-
- Bye
- /Andreas
- --
- | Andreas Magnusson || Vet ni varf|r datavetare {r s} |
- | Linkoping Institute of Technology || smarta? Jo, de LISTAR ut allt! |
- | c89andma@odalix.ida.liu.se || Karin Willborg, C89 LiTH |
- | zune@nanny.lysator.liu.se ||(This is in Swedish, it's a bad joke)|
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-
-
-